<?php

namespace App\Models;

use Dcat\Admin\Models\Administrator;
use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SwtReplenish extends Model
{
    use HasFactory;

    use HasDateTimeFormatter;

    protected $table = 'swt_replenish';

    protected $guarded = [];

    public function merchant()
    {
        return $this->hasOne(SwtMerchant::class, 'id', 'merchant_id');
    }

    public function machine()
    {
        return $this->hasOne(SwtMachine::class, 'id', 'machine_id');
    }

    public function replenish_good()
    {
        return $this->hasMany(SwtReplenishGoods::class, 'replenish_id', 'id');
    }

    public function administrator() {
        return $this->hasOne(Administrator::class, 'id', 'admin_id');
    }
}
